import React, {useEffect, useState} from "react";
import {Radio, Switch} from "antd";
import CommonFlex from "../CommonFlex/index";
import "./index.less";

interface Props {
    label: string, //组件左边label
    type: string,  // 选择类型
    value: boolean, // 默认值
    onChange?: (value: string) => void
};

const LayoutSwitchFlex = (props: Props) => {

    const {label, type, value, onChange} = props;

    const handleChange = (e: any) => {
        onChange(e);
    };

    return (
        <CommonFlex>
            {label}
            <div className="layout-flex-box">
                <div className="layout-flex-text">{value? "显示" : "隐藏"}</div>
                <div className="layout-flex-btns">
                    <Switch size="small" onChange={handleChange} defaultChecked={value} />
                </div>
            </div>
        </CommonFlex>
    );
};
export default LayoutSwitchFlex;